home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat2 / standard / blockproc.z / blockproc
Encoding:
Text File  |  1998-10-20  |  6.9 KB  |  133 lines

  1.  
  2.  
  3.  
  4. BBBBLLLLOOOOCCCCKKKKPPPPRRRROOOOCCCC((((2222))))                                                      BBBBLLLLOOOOCCCCKKKKPPPPRRRROOOOCCCC((((2222))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      blockproc, unblockproc, setblockproccnt, blockprocall, unblockprocall,
  10.      setblockproccntall - routines to block/unblock processes
  11.  
  12. CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ttttyyyyppppeeeessss....hhhh>>>>
  14.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////pppprrrrccccttttllll....hhhh>>>>
  15.  
  16.      iiiinnnntttt bbbblllloooocccckkkkpppprrrroooocccc ((((ppppiiiidddd____tttt ppppiiiidddd))));;;;
  17.  
  18.      iiiinnnntttt uuuunnnnbbbblllloooocccckkkkpppprrrroooocccc ((((ppppiiiidddd____tttt ppppiiiidddd))));;;;
  19.  
  20.      iiiinnnntttt sssseeeettttbbbblllloooocccckkkkpppprrrrooooccccccccnnnntttt ((((ppppiiiidddd____tttt ppppiiiidddd,,,, iiiinnnntttt ccccoooouuuunnnntttt))));;;;
  21.  
  22.      iiiinnnntttt bbbblllloooocccckkkkpppprrrrooooccccaaaallllllll ((((ppppiiiidddd____tttt ppppiiiidddd))));;;;
  23.  
  24.      iiiinnnntttt uuuunnnnbbbblllloooocccckkkkpppprrrrooooccccaaaallllllll ((((ppppiiiidddd____tttt ppppiiiidddd))));;;;
  25.  
  26.      iiiinnnntttt sssseeeettttbbbblllloooocccckkkkpppprrrrooooccccccccnnnnttttaaaallllllll ((((ppppiiiidddd____tttt ppppiiiidddd,,,, iiiinnnntttt ccccoooouuuunnnntttt))));;;;
  27.  
  28. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  29.      These routines provide a complete set of blocking/unblocking capabilities
  30.      for processes.  Blocking is implemented with a counting semaphore in the
  31.      kernel.  Each call to _b_l_o_c_k_p_r_o_c decrements the count.  When the count
  32.      becomes negative, the process is suspended.  When _u_n_b_l_o_c_k_p_r_o_c is called,
  33.      the count is incremented.  If the count becomes non-negative (>= 0), the
  34.      process is restarted.  This provides both a simple, race free
  35.      synchronization ability between two processes and a much more powerful
  36.      capability to synchronize multiple processes.
  37.  
  38.      In order to guarantee a known starting place, the _s_e_t_b_l_o_c_k_p_r_o_c_c_n_t
  39.      function may be called, which will force the semaphore count to the value
  40.      given by _c_o_u_n_t.  New processes have their semaphore zeroed.  Normally,
  41.      _c_o_u_n_t should be set to 0.  If the resulting block count is greater than
  42.      or equal to zero and the process is currently blocked, it will be
  43.      unblocked.  If the resulting block count is less than zero, the process
  44.      will be blocked.  Using this, a simple rendezvous mechanism can be set
  45.      up.  If one process wants to wait for _n other processes to complete, it
  46.      could set its block count to -_n. This would immediately force the process
  47.      to block.  Then as each process finishes, it unblocks the waiting
  48.      process.  When the _n'_t_h process finishes the waiting process will be
  49.      awakened.
  50.  
  51.      The _b_l_o_c_k_p_r_o_c_a_l_l, _u_n_b_l_o_c_k_p_r_o_c_a_l_l, and _s_e_t_b_l_o_c_k_p_r_o_c_c_n_t_a_l_l system calls
  52.      perform the same actions as _b_l_o_c_k_p_r_o_c, _u_n_b_l_o_c_k_p_r_o_c, and _s_e_t_b_l_o_c_k_p_r_o_c_c_n_t,
  53.      respectively, but act on all processes in the given process' share group.
  54.      A share group is a group of processes created with the _s_p_r_o_c(_2) system
  55.      call.  If a process does not belong to a share group, the effect of the
  56.      plural form of a call will be the same as that of the singular form.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. BBBBLLLLOOOOCCCCKKKKPPPPRRRROOOOCCCC((((2222))))                                                      BBBBLLLLOOOOCCCCKKKKPPPPRRRROOOOCCCC((((2222))))
  71.  
  72.  
  73.  
  74.      A process may block another provided that standard UNIX permissions are
  75.      satisfied.
  76.  
  77.      A process may determine whether another is blocked by using the _p_r_c_t_l(_2)
  78.      system call.  It should be noted that since other processes may unblock
  79.      the subject process at any time, the answer should be interpreted as a
  80.      snapshot only.
  81.  
  82.      These interfaces are not supported for POSIX Threads applications.
  83.  
  84.      These routines will fail and no operation will be performed if one or
  85.      more of the following are true:
  86.  
  87.      [ESRCH]        The _p_i_d specified does not exist.
  88.  
  89.      [EPERM]        The caller is not operating on itself, its effective user
  90.                     ID is not super-user, and its real or effective user ID
  91.                     does not match the real or effective user ID of the target
  92.                     process.
  93.  
  94.      [EPERM]        The target process is a POSIX Threads application.
  95.  
  96.      [EINVAL]       The count value that would result from the requested
  97.                     _b_l_o_c_k_p_r_o_c, _u_n_b_l_o_c_k_p_r_o_c or _s_e_t_b_l_o_c_k_p_r_o_c_c_n_t is less than
  98.                     PPPPRRRR____MMMMIIIINNNNBBBBLLLLOOOOCCCCKKKKCCCCNNNNTTTT or greater than PPPPRRRR____MMMMAAAAXXXXBBBBLLLLOOOOCCCCKKKKCCCCNNNNTTTT as defined
  99.                     in _s_y_s/_p_r_c_t_l._h.
  100.  
  101. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  102.      sproc(2), prctl(2).
  103.  
  104. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  105.      Upon successful completion, 0 is returned.  Otherwise, a value of -1 is
  106.      returned to the calling process, and _e_r_r_n_o is set to indicate the error.
  107.      When using the _b_l_o_c_k_p_r_o_c_a_l_l, _u_n_b_l_o_c_k_p_r_o_c_a_l_l, and _s_e_t_b_l_o_c_k_p_r_o_c_c_n_t_a_l_l
  108.      calls, an error may occur on any of the processes in the share group.
  109.      These calls will attempt to perform the given action on each process in
  110.      the share group despite earlier errors, and set _e_r_r_n_o to indicate the
  111.      error of the last failure to occur.
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.